package com.ruoyi.order.domain.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.order.domain.VerOrderItem;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class VerOrderItemDto {
    /** 订单号（主键） */
    private Long orderId;

    /** 用户ID（外键，关联user表） */
    @Excel(name = "用户ID", readConverterExp = "外=键，关联user表")
    private Long userId;

    /** 收货地址ID（外键，关联address 表) */
    @Excel(name = "收货地址ID", readConverterExp = "收货地址ID（外键，关联address 表)")
    private Long addressId;

    /** 订单总金额（含商品、运费等） */
    @Excel(name = "订单总金额", readConverterExp = "含=商品、运费等")
    private String totalAmount;

    /** 折扣类型（0无折扣，1优惠券，2积分抵扣，3满减） */
    @Excel(name = "折扣类型", readConverterExp = "0=无折扣，1优惠券，2积分抵扣，3满减")
    private Long discountType;

    /** 实付金额（扣除优惠券、积分后） */
    @Excel(name = "实付金额", readConverterExp = "扣=除优惠券、积分后")
    private String payAmount;

    /** 运费 */
    @Excel(name = "运费")
    private String freight;

    /** 运输方式 */
    @Excel(name = "运输方式")
    private Integer shipMethod;

    /** 订单状态（0待付款，1待发货，2待收货，3已完成，10已取消 */
    @Excel(name = "订单状态", readConverterExp = "订单状态（0待付款，1待发货，2待收货，3已完成，10已取消")
    private String status;

    /** 支付时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date payTime;

    /** 发货时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发货时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date shipTime;

    /** 确认收货时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "确认收货时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date receiveTime;

    /** 订单项列表 */
    private List<VerOrderItem> orderItems;

    // 以下字段用于承接明细行数据，服务层将其组装进 orderItems
    @JsonIgnore
    private Long orderItemId;
    @JsonIgnore
    private Long skuId;
    @JsonIgnore
    private Long quantity;
    @JsonIgnore
    private BigDecimal unitPrice;
    @JsonIgnore
    private BigDecimal totalPrice;

    // SKU相关字段
    @JsonIgnore
    private Long spuId;
    @JsonIgnore
    private String code;
    @JsonIgnore
    private String categoryId;
    @JsonIgnore
    private String specData;
    @JsonIgnore
    private BigDecimal price;
    @JsonIgnore
    private BigDecimal originalPrice;
    @JsonIgnore
    private String skuName;
    @JsonIgnore
    private String description;
    @JsonIgnore
    private Long stock;
    @JsonIgnore
    private Long lowStock;
    @JsonIgnore
    private BigDecimal weight;
    @JsonIgnore
    private BigDecimal volume;
    @JsonIgnore
    private Long skuStatus;
    @JsonIgnore
    private String specNameGroup;
    @JsonIgnore
    private String specValueGroup;
    @JsonIgnore
    private List<String> urls;
    @JsonIgnore
    private String url;

}
